interface Equ {
	boolean isHit(int n, int x, int y);
}

public class LetterPrinter {
	static Equ H = new Equ() {
		public boolean isHit(int n, int x, int y) {

			return x == 0 || x == n || y == ((n) / 2);
		}
	}, E = new Equ() {
		public boolean isHit(int n, int x, int y) {
			return x == 0 || y == n / 2 || y == 0 || y == n;
		}
	}, L = new Equ() {
		public boolean isHit(int n, int x, int y) {
			return x == 0 || y == n;
		}
	}, O = new Equ() {
		public boolean isHit(int n, int x, int y) {
			return x == 0 || x == n || y == 0 || y == n;
		}
	};
	static Equ[] HELLO = { H, E, L, L, O };

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		for (int i = 3; i < 10; i++) {
			System.out.println(printStarHello(i));

			System.out.println("1:N" + i);
			System.out.println(printStarN(i)); // Utils.pause(1000);

			System.out.println("2:Z" + i);
			System.out.println(printStarZ(i)); //

			System.out.println("3:U" + i);
			System.out.println(printStarU(i)); //

			System.out.println("4:O" + i);
			System.out.println(printStarO(i)); //

			System.out.println("5:L" + i);
			System.out.println(printStarL(i)); //

			System.out.println("6:X" + i);
			System.out.println(printStarX(i)); //

			System.out.println("7:H" + i);
			System.out.println(printStarH(i)); //

			System.out.println("8:E" + i);
			System.out.println(printStarE(i)); //

		}

	}

	/**
	 * EC
	 * 
	 * @param n
	 * @return
	 */
	public static String printStarHello(int n) {
		return renderLetters(n, HELLO);
	}

	/**
	 * 1
	 * 
	 * @param n
	 * @return
	 */
	public static String printStarN(int n) {
		return renderLetter(n, new Equ() {
			public boolean isHit(int n, int x, int y) {
				return x == 0 || x == n || x == y;
			}
		});
	}

	/**
	 * 2
	 * 
	 * @param n
	 * @return
	 */
	public static String printStarZ(int n) {
		return renderLetter(n, new Equ() {
			public boolean isHit(int n, int x, int y) {
				return y == 0 || y == n || n == x + y;
			}
		});
	}

	/**
	 * 3
	 * 
	 * @param n
	 * @return
	 */
	public static String printStarU(int n) {
		return renderLetter(n, new Equ() {
			public boolean isHit(int n, int x, int y) {
				return x == 0 || x == n || y == n;
			}
		});
	}

	/**
	 * 4
	 * 
	 * @param n
	 * @return
	 */
	public static String printStarO(int n) {
		return renderLetter(n, new Equ() {
			public boolean isHit(int n, int x, int y) {
				return (int) Math.sqrt(Math.pow(n / 2 - x, 2)
						+ Math.pow(n / 2 - y, 2)) == n / 2;
			}
		});
	}

	/**
	 * 5
	 * 
	 * @param n
	 * @return
	 */
	public static String printStarL(int n) {
		return renderLetter(n, new Equ() {
			public boolean isHit(int n, int x, int y) {
				return x == 0 || y == n;
			}
		});
	}

	/**
	 * 6
	 * 
	 * @param n
	 * @return
	 */
	public static String printStarX(int n) {
		return renderLetter(n, new Equ() {
			public boolean isHit(int n, int x, int y) {
				return x == y || n == x + y;
			}
		});
	}

	/**
	 * 7
	 * 
	 * @param n
	 * @return
	 */
	public static String printStarH(int n) {
		return renderLetter(n, H);
	}

	/**
	 * 8
	 * 
	 * @param n
	 * @return
	 */
	public static String printStarE(int n) {
		return renderLetter(n, E);
	}

	public static String renderLetter(int n, Equ e) {
		String o = "";
		for (int y = 0; y <= n - 1; y++) {
			for (int x = 0; x <= n - 1; x++) {
				o += e.isHit(n - 1, x, y) ? "*" : " ";
			}
			o += "\n";
		}
		return o;
	}

	public static String renderLetters(int n, Equ[] equs) {
		String o = "";
		for (int y = 0; y <= n - 1; y++) {
			for (int i = 0; equs.length > i; i++) {
				Equ e = equs[i];
				for (int x = 0; x <= n - 1; x++) {
					o += e.isHit(n - 1, x, y) ? "*" : " ";
				}
				for (int x = 0; x <= n / 2; x++) {
					o += " ";
				}

			}
			o += "\n";
		}
		return o;
	}
}